{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np  # 矩阵操作\n",
    "import pandas as pd # SQL数据处理\n",
    "\n",
    "from sklearn.metrics import r2_score  #评价回归预测模型的性能\n",
    "\n",
    "import matplotlib.pyplot as plt   #画图\n",
    "import seaborn as sns\n",
    "\n",
    "# 图形出现在Notebook里而不是新窗口\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true,
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "#我是直接将原始文件分成两个，再分别导入\n",
    "data = pd.read_csv(\"trainset.csv\")\n",
    "data2 = pd.read_csv(\"testset.csv\")\n",
    "\n",
    "#通过观察前5行，了解数据每列（特征）的概况\n",
    "#data.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>dteday</th>\n",
       "      <th>season</th>\n",
       "      <th>yr</th>\n",
       "      <th>mnth</th>\n",
       "      <th>holiday</th>\n",
       "      <th>weekday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>weathersit</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>casual</th>\n",
       "      <th>registered</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2011-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.344167</td>\n",
       "      <td>0.363625</td>\n",
       "      <td>0.805833</td>\n",
       "      <td>0.160446</td>\n",
       "      <td>331</td>\n",
       "      <td>654</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2011-01-02</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.363478</td>\n",
       "      <td>0.353739</td>\n",
       "      <td>0.696087</td>\n",
       "      <td>0.248539</td>\n",
       "      <td>131</td>\n",
       "      <td>670</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>2011-01-03</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.196364</td>\n",
       "      <td>0.189405</td>\n",
       "      <td>0.437273</td>\n",
       "      <td>0.248309</td>\n",
       "      <td>120</td>\n",
       "      <td>1229</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>2011-01-04</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.200000</td>\n",
       "      <td>0.212122</td>\n",
       "      <td>0.590435</td>\n",
       "      <td>0.160296</td>\n",
       "      <td>108</td>\n",
       "      <td>1454</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>2011-01-05</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.226957</td>\n",
       "      <td>0.229270</td>\n",
       "      <td>0.436957</td>\n",
       "      <td>0.186900</td>\n",
       "      <td>82</td>\n",
       "      <td>1518</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant      dteday  season  yr  mnth  holiday  weekday  workingday  \\\n",
       "0        1  2011-01-01       1   0     1        0        6           0   \n",
       "1        2  2011-01-02       1   0     1        0        0           0   \n",
       "2        3  2011-01-03       1   0     1        0        1           1   \n",
       "3        4  2011-01-04       1   0     1        0        2           1   \n",
       "4        5  2011-01-05       1   0     1        0        3           1   \n",
       "\n",
       "   weathersit      temp     atemp       hum  windspeed  casual  registered  \\\n",
       "0           2  0.344167  0.363625  0.805833   0.160446     331         654   \n",
       "1           2  0.363478  0.353739  0.696087   0.248539     131         670   \n",
       "2           1  0.196364  0.189405  0.437273   0.248309     120        1229   \n",
       "3           1  0.200000  0.212122  0.590435   0.160296     108        1454   \n",
       "4           1  0.226957  0.229270  0.436957   0.186900      82        1518   \n",
       "\n",
       "    cnt  \n",
       "0   985  \n",
       "1   801  \n",
       "2  1349  \n",
       "3  1562  \n",
       "4  1600  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>dteday</th>\n",
       "      <th>season</th>\n",
       "      <th>yr</th>\n",
       "      <th>mnth</th>\n",
       "      <th>holiday</th>\n",
       "      <th>weekday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>weathersit</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>casual</th>\n",
       "      <th>registered</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2012-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.370000</td>\n",
       "      <td>0.375621</td>\n",
       "      <td>0.692500</td>\n",
       "      <td>0.192167</td>\n",
       "      <td>686</td>\n",
       "      <td>1608</td>\n",
       "      <td>2294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2012-01-02</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.273043</td>\n",
       "      <td>0.252304</td>\n",
       "      <td>0.381304</td>\n",
       "      <td>0.329665</td>\n",
       "      <td>244</td>\n",
       "      <td>1707</td>\n",
       "      <td>1951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>2012-01-03</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.150000</td>\n",
       "      <td>0.126275</td>\n",
       "      <td>0.441250</td>\n",
       "      <td>0.365671</td>\n",
       "      <td>89</td>\n",
       "      <td>2147</td>\n",
       "      <td>2236</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>2012-01-04</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0.107500</td>\n",
       "      <td>0.119337</td>\n",
       "      <td>0.414583</td>\n",
       "      <td>0.184700</td>\n",
       "      <td>95</td>\n",
       "      <td>2273</td>\n",
       "      <td>2368</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>2012-01-05</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.265833</td>\n",
       "      <td>0.278412</td>\n",
       "      <td>0.524167</td>\n",
       "      <td>0.129987</td>\n",
       "      <td>140</td>\n",
       "      <td>3132</td>\n",
       "      <td>3272</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant      dteday  season  yr  mnth  holiday  weekday  workingday  \\\n",
       "0        1  2012-01-01       1   1     1        0        0           0   \n",
       "1        2  2012-01-02       1   1     1        1        1           0   \n",
       "2        3  2012-01-03       1   1     1        0        2           1   \n",
       "3        4  2012-01-04       1   1     1        0        3           1   \n",
       "4        5  2012-01-05       1   1     1        0        4           1   \n",
       "\n",
       "   weathersit      temp     atemp       hum  windspeed  casual  registered  \\\n",
       "0           1  0.370000  0.375621  0.692500   0.192167     686        1608   \n",
       "1           1  0.273043  0.252304  0.381304   0.329665     244        1707   \n",
       "2           1  0.150000  0.126275  0.441250   0.365671      89        2147   \n",
       "3           2  0.107500  0.119337  0.414583   0.184700      95        2273   \n",
       "4           1  0.265833  0.278412  0.524167   0.129987     140        3132   \n",
       "\n",
       "    cnt  \n",
       "0  2294  \n",
       "1  1951  \n",
       "2  2236  \n",
       "3  2368  \n",
       "4  3272  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data2.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(365, 16)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(366, 16)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "y = data['cnt'].values\n",
    "X = data.drop('cnt', axis = 1)\n",
    "X = X.drop('registered', axis = 1)\n",
    "X = X.drop('casual', axis = 1)\n",
    "\n",
    "y2 = data2['cnt'].values\n",
    "X2 = data2.drop('cnt', axis = 1)\n",
    "X2 = X2.drop('registered', axis = 1)\n",
    "X2 = X2.drop('casual', axis = 1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将训练集和测试集分别减去均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_mean = y.mean()\n",
    "for i in range(365):\n",
    "    y[i]=y[i]-y_mean"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "y2_mean = y2.mean()\n",
    "for i in range(366):\n",
    "    y2[i]=y2[i]-y2_mean"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "#丢弃一些不必要的特征：年分yr是个概率为1的定值，任何一个概率和1作用其值不会变\n",
    "\n",
    "X = X.drop('yr', axis = 1)\n",
    "X2 = X2.drop('yr', axis = 1)\n",
    "\n",
    "#dteday和instant一样是从年初到年尾逐个变化的，这个也可以舍去。\n",
    "X = X.drop('dteday', axis = 1)\n",
    "X2 = X2.drop('dteday', axis = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#用于后续显示权重系数对应的特征\n",
    "columns = X.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(365, 11)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train, X_test, y_train, y_test = (X, X2, y, y2)\n",
    "X_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(366, 11)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_test.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## 数据预处理／特征工程"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/wlq666888/APPs/Anaconda3-5.0.1-Linux-x86_64/Anaconda3-5.0.1/lib/python3.6/site-packages/sklearn/utils/validation.py:475: DataConversionWarning: Data with input dtype int64 was converted to float64 by StandardScaler.\n",
      "  warnings.warn(msg, DataConversionWarning)\n"
     ]
    }
   ],
   "source": [
    "# 数据标准化\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "\n",
    "# 分别初始化对特征和目标值的标准化器\n",
    "ss_X = StandardScaler()\n",
    "ss_y = StandardScaler()\n",
    "\n",
    "# 分别对训练和测试数据的特征以及目标值进行标准化处理\n",
    "X_train = ss_X.fit_transform(X_train)\n",
    "X_test = ss_X.transform(X_test)\n",
    "\n",
    "#对y做标准化不是必须\n",
    "#对y标准化的好处是不同问题的w差异不太大，同时正则参数的范围也有限\n",
    "y_train = ss_y.fit_transform(y_train.reshape(-1, 1))\n",
    "y_test = ss_y.transform(y_test.reshape(-1, 1))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## 确定模型类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 线性回归\n",
    "#class sklearn.linear_model.LinearRegression(fit_intercept=True, normalize=False, copy_X=True, n_jobs=1)\n",
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "# 使用默认配置初始化\n",
    "lr = LinearRegression()\n",
    "\n",
    "# 训练模型参数\n",
    "lr.fit(X_train, y_train)\n",
    "\n",
    "# 预测\n",
    "y_test_pred_lr = lr.predict(X_test)\n",
    "y_train_pred_lr = lr.predict(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>[0.696872603492]</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>[0.593066294028]</td>\n",
       "      <td>mnth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>[0.292949119385]</td>\n",
       "      <td>season</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>[0.0351745498474]</td>\n",
       "      <td>weekday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>[0.00757134060956]</td>\n",
       "      <td>workingday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>[-0.0353950397988]</td>\n",
       "      <td>holiday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>[-0.0534050464647]</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>[-0.0628202221594]</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>[-0.122264985044]</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>[-0.231182077272]</td>\n",
       "      <td>weathersit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>[-0.589867988226]</td>\n",
       "      <td>instant</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  coef     columns\n",
       "7     [0.696872603492]        temp\n",
       "2     [0.593066294028]        mnth\n",
       "1     [0.292949119385]      season\n",
       "4    [0.0351745498474]     weekday\n",
       "5   [0.00757134060956]  workingday\n",
       "3   [-0.0353950397988]     holiday\n",
       "9   [-0.0534050464647]         hum\n",
       "8   [-0.0628202221594]       atemp\n",
       "10   [-0.122264985044]   windspeed\n",
       "6    [-0.231182077272]  weathersit\n",
       "0    [-0.589867988226]     instant"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef\":list((lr.coef_.T))})\n",
    "fs.sort_values(by=['coef'],ascending=False)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看出temp属性和mnth属性以及instant属性是重要的，season和weathersit是稍微重要的，其他的不重要。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LinearRegression on test is 0.638599373987\n",
      "The r2 score of LinearRegression on train is 0.760892059752\n"
     ]
    }
   ],
   "source": [
    "# 使用r2_score评价模型在测试集和训练集上的性能，并输出评估结果\n",
    "#测试集\n",
    "print('The r2 score of LinearRegression on test is', r2_score(y_test, y_test_pred_lr)) \n",
    "#训练集\n",
    "print('The r2 score of LinearRegression on train is', r2_score(y_train, y_train_pred_lr))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "结果显示模型预测较好，63.86%的正确率。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAekAAAFsCAYAAADos0H8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo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Uo466ig+9rGP8YlPfILjjjuOo4466kXLu+OOO5g+fTrt7bWHPZ144on8/ve/32wNmcmn\nPvUp5s+fzzbbbMOKFStYtWoVu++++4Z5Dj/8cE4//XSef/55TjjhBDo6OvrV3mOPPZaRI0cycuRI\nxo0bx6pVq5g3bx4LFy7k8MMP3/CdjBs3DoCrr76auXPnsm7dOlauXMl99923IaRPPPHEftXQF3d3\nS5KAvx+Tfvjhh3nuuec2HJPOTM4991wWLVrEokWLWLZsGbNmzWK//fZj4cKFHHzwwZx77rmcf/75\nmyyzt0uQtt12W1544YUNy3/uuecAuOKKK1i9ejULFy5k0aJF7LbbbptcZ3z00Uczf/589txzT04+\n+WQuu+yyfrV35MiRG4ZHjBjBunXryExOPfXUDW393e9+x5w5c3jwwQe54IILmDdvHnfffTfHHnvs\ni+rafvvt+1VDX+xJSxo09Z6x3Ogzm7VlxowZw4UXXsjMmTM566yzePOb38xnPvMZTjrpJEaPHs2K\nFStoa2tj3bp1jB07lve+972MHj2aSy655EXLedWrXsU555zDmjVr2HHHHbnmmms49NBDgdpx3IUL\nF/Kud72L66+/nueffx6o7TIfN24cbW1t3HLLLTz88KZPdHz44YfZc889OfPMM3n66ae56667OOWU\nUxrS9hkzZjBz5kw+/OEPM27cOP785z/z1FNP8eSTT7L99tszZswYVq1axY033sj06dMbss7NMaQl\nqUBD/YfKlClTOPTQQ7nyyis5+eSTWbJkCdOmTQNqJ3ldfvnlLFu2jI9//ONss802tLW1cfHFF79o\nGePHj2fOnDlMmzaN8ePHc9hhh204CevMM89k5syZTJ06lRkzZmzoiZ500km87W1vo7Ozk46ODl7x\nildsUtutt97KV77yFdra2hg9enSvPeljjz12wz2zp02bxgc/+ME+233AAQfw+c9/nje96U288MIL\ntLW1cdFFF3HEEUcwZcoUDjzwQPbaay+OPPLI+r/MAYjMHJQVAXR2dmbXGX+SWo896d4tWbKE/fff\nf6jLUBP0tG0jYmFmdvbykQ08Ji1JUqEMaUmSCmVIS1IhBvPwowbHQLepIS1JB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XY796Gedv0b8OPMfDYi3k9tj8Lrm17Z0Buu27wvd1G7D/fa\niHgr8FNqu/wbwpDup8x8QwOW8Uj189GIuI7arrSiQ7oB7d5qbye7ubZHxKqIGJ+ZK6tdfI/2soyu\nbf5ARNwKTAG2tpCuZxt2zbM8IrYFxjCEuwwbqM+2Z+aabm+/wzA5Hl+Hrfbf9kBk5pPdhn8REd+K\niF0zsyEPHHF39xCJiO0jYoeuYeBN1E68Gu6G6+1kbwBOrYZPBTbZqxARO0fEyGp4V+BI4L5Bq7Bx\n6tmG3b+PdwC/zOFx56Q+277RcdjjgSWDWN9QugE4pTrL+wjgia5DQMNZROzedb5FREyllqtrNv+p\nLZCZvhr8At5O7a/KZ4FVwL9X4/cAflEN7wX8tnrdS2138ZDX3ux2V+/fCvyeWg9yq2931aZdqJ3V\nvbT6ObYa3wl8txp+NXBPtc3vAWYNdd0DaO8m2xA4Hzi+Gh4FXAMsA+4E9hrqmgex7V+s/k3/FrgF\neMVQ19ygdv8YWAk8X/07nwW8H3h/NT2onfn+h+r3u3Ooax6kdp/dbXv/Bnh1I9fvbUElSSqUu7sl\nSSqUIS1JUqEMaUmSCmVIS5JUKENakqRCGdKSJBXKkJYkqVD/HwYkIcUUKOS7AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f77d95e1630>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 5)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_train - y_train_pred_lr,bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看出， 左侧存在噪声，可以考虑排除。整体残差分布和高斯分布比较匹配，"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARgAAADQCAYAAADcQn7hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xl8lPW1+PHPyTBkgUCAsEhEoerF\nBVkELUgtYrXiyqKilnrBVqytdUOpuMvt7cWKVW/r/VkttriLC/ITUsUFtaKigIREivS6IhGBAGHL\nNpmc+8fMxGQyy5PJzDxZzvv1yovMZGaekyE5+a7nK6qKMcakQobbARhj2i9LMMaYlLEEY4xJGUsw\nxpiUsQRjjEkZSzDGmJSxBGOMSRlLMMaYlLEEY4xJmU5uB9Ac+fn5OnDgQLfDMKbDW7t2bZmq9o73\nuDaVYAYOHMiaNWvcDsOYDk9EvnLyOOsiGWNSxhKMMSZlXEswIpIlIh+KyHoR2SAic92KxRiTGm6O\nwVQDp6jqfhHxAitF5GVVXeViTMaYJHKtBaMB+4M3vcEPK05jjAtqampS8rqujsGIiEdEioDtwGuq\n+kGEx1wuImtEZM2OHTvSH6Qx7VxxcTEjR47kqaeeSvpru5pgVNWvqsOBg4ETRGRIhMc8rKqjVHVU\n795xp92NMQ7V1dVx7733cvzxx1NWVkavXr2Sfo1WMYukquXAW8AEl0MxpkPYsmULp512Gtdffz1n\nnHEGxcXFnH766Um/jpuzSL1FJC/4eTZwKvCJW/EY05GsXr2aDz74gAULFvDiiy+Sqt6Bm7NIBwGP\nioiHQKJ7VlWXuRiPMe3anj17eO+99zjjjDOYPHkyn3/+OX369EnpNV1LMKpaDIxw6/rGdCTvvPMO\nl1xyCTt27OCrr74iPz8/5ckFWskYjDEmNWpqarjllls4+eST8Xg8vP766+Tn56ft+m1qs6Mxxjmf\nz8dJJ53Ehx9+yM9//nPuu+8+cnNz0xqDt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GZGef5KAnV61gFP\nq2pRrIupajFwN/CPYOW1+c28nnGBTVObtBORy4Ahqnqt27GY1LIWjDEmZawFY4xJGWvBGGNSxhKM\nMSZlLMEYY1LGEowxJmUswRhjUub/ANt/hBuW6GX4AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f77d13b0b70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#还可以观察预测值与真值的散点图\n",
    "plt.figure(figsize=(4, 3))\n",
    "plt.scatter(y_train, y_train_pred_lr)\n",
    "plt.plot([-3, 3], [-3, 3], '--k')   #数据已经标准化，3倍标准差即可\n",
    "plt.axis('tight')\n",
    "plt.xlabel('True price')\n",
    "plt.ylabel('Predicted price')\n",
    "plt.tight_layout()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "模型整体散点完好，存在部分离群点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 线性模型，随机梯度下降优化模型参数\n",
    "# 随机梯度下降一般在大数据集上应用，其实本项目不适合用\n",
    "#from sklearn.linear_model import SGDRegressor\n",
    "\n",
    "# 使用默认配置初始化线\n",
    "#sgdr = SGDRegressor(max_iter=1000)\n",
    "\n",
    "# 训练：参数估计\n",
    "#sgdr.fit(X_train, y_train)\n",
    "\n",
    "# 预测\n",
    "#sgdr_y_predict = sgdr.predict(X_test)\n",
    "\n",
    "#sgdr.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 使用SGDRegressor模型自带的评估模块(评价准则为r2_score)，并输出评估结果\n",
    "#print('The value of default measurement of SGDRegressor on test is', sgdr.score(X_test, y_test))\n",
    "#print('The value of default measurement of SGDRegressor on train is', sgdr.score(X_train, y_train)) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 正则化的线性回归（L2正则 --> 岭回归）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of RidgeCV on test is 0.639892148541\n",
      "The r2 score of RidgeCV on train is 0.760218144342\n"
     ]
    }
   ],
   "source": [
    "#岭回归／L2正则\n",
    "#class sklearn.linear_model.RidgeCV(alphas=(0.1, 1.0, 10.0), fit_intercept=True, \n",
    "#                                  normalize=False, scoring=None, cv=None, gcv_mode=None, \n",
    "#                                  store_cv_values=False)\n",
    "from sklearn.linear_model import  RidgeCV\n",
    "\n",
    "#设置超参数（正则参数）范围 在log域内取值\n",
    "alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "#n_alphas = 20\n",
    "#alphas = np.logspace(-5,2,n_alphas)\n",
    "\n",
    "#生成一个RidgeCV实例\n",
    "ridge = RidgeCV(alphas=alphas, store_cv_values=True)  \n",
    "\n",
    "#模型训练\n",
    "ridge.fit(X_train, y_train)    \n",
    "\n",
    "#预测\n",
    "y_test_pred_ridge = ridge.predict(X_test)\n",
    "y_train_pred_ridge = ridge.predict(X_train)\n",
    "\n",
    "\n",
    "# 评估，使用r2_score评价模型在测试集和训练集上的性能\n",
    "print ('The r2 score of RidgeCV on test is', r2_score(y_test, y_test_pred_ridge))\n",
    "print ('The r2 score of RidgeCV on train is', r2_score(y_train, y_train_pred_ridge))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "变化幅度不是很大。但还是好的"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEKCAYAAAA4t9PUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndH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wE5gN3\nAh9IWOYaoCHh/b3uXgssAD5sZguSbKcC2OTui4CfA19NmFfi7kuAP0uY3gR8LGy/EviHhPYx4Lpz\n/6gi56YgB20UOQ/XEoyC2w0cNLOfA1eG09e4ew/wjpk9l7DMZKA54f2KcGj/knDePIJhLRL1AKvD\n1/8GJA7A1/u6gSC8AEqBfzKzK4Bu4KKE9k0EQ9WIREpBIpKa/h4yNdDDp04SjKGFmc0C7gaudPej\nZvYvvfPOInEMo9Phz27e/b/75wRjnF1O0MNwKqH98LAGkUipa0skNc8DK82sODxv8SGCwRV/SfDg\npyIzm0jwuNVeO4ALw9ejgRNAa9jupn62U0Qw+i/Ab4frH0glcCA8IvoCweNze11Eboz+LHlORyQi\nqXmU4PzHywRHCX/p7u+Y2cPARwm+sN8geDJda7jMEwTB8oy7v2xmmwlGh90F/Kqf7ZwALjWzhnA9\nK89S13eAh81sOcHovCcS5l0f1iASKY3+K5ImMxvpwVPxxhEcpVwThswIgi/3a8JzK6msq83dRw5S\nXc8Dt7j70cFYn0h/dEQikr6fmFkVUAb8jbu/A+DuJ83sqwTPxn47kwWF3W/fUohIJuiIRERE0qKT\n7SIikhYFiYiIpEVBIiIiaVGQiIhIWhQkIiKSFgWJiIik5f8DdOS344VwALEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f77d12d0b70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 1.0\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>[0.696872603492]</td>\n",
       "      <td>[0.509706171955]</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>[0.593066294028]</td>\n",
       "      <td>[0.322924138591]</td>\n",
       "      <td>mnth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>[0.292949119385]</td>\n",
       "      <td>[0.29485530753]</td>\n",
       "      <td>season</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>[0.0351745498474]</td>\n",
       "      <td>[0.0355210529109]</td>\n",
       "      <td>weekday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>[0.00757134060956]</td>\n",
       "      <td>[0.00760200478082]</td>\n",
       "      <td>workingday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>[-0.0353950397988]</td>\n",
       "      <td>[-0.0342330597427]</td>\n",
       "      <td>holiday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>[-0.0534050464647]</td>\n",
       "      <td>[-0.0579147033201]</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>[-0.0628202221594]</td>\n",
       "      <td>[0.124916787824]</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>[-0.122264985044]</td>\n",
       "      <td>[-0.119995506635]</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>[-0.231182077272]</td>\n",
       "      <td>[-0.226389415899]</td>\n",
       "      <td>weathersit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>[-0.589867988226]</td>\n",
       "      <td>[-0.322358198929]</td>\n",
       "      <td>instant</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               coef_lr          coef_ridge     columns\n",
       "7     [0.696872603492]    [0.509706171955]        temp\n",
       "2     [0.593066294028]    [0.322924138591]        mnth\n",
       "1     [0.292949119385]     [0.29485530753]      season\n",
       "4    [0.0351745498474]   [0.0355210529109]     weekday\n",
       "5   [0.00757134060956]  [0.00760200478082]  workingday\n",
       "3   [-0.0353950397988]  [-0.0342330597427]     holiday\n",
       "9   [-0.0534050464647]  [-0.0579147033201]         hum\n",
       "8   [-0.0628202221594]    [0.124916787824]       atemp\n",
       "10   [-0.122264985044]   [-0.119995506635]   windspeed\n",
       "6    [-0.231182077272]   [-0.226389415899]  weathersit\n",
       "0    [-0.589867988226]   [-0.322358198929]     instant"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mse_mean = np.mean(ridge.cv_values_, axis = 0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1)) \n",
    "\n",
    "#这是为了标出最佳参数的位置，不是必须\n",
    "#plt.plot(np.log10(ridge.alpha_)*np.ones(3), [0.28, 0.29, 0.30])\n",
    "\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', ridge.alpha_)\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "alpha为1的时候为最佳"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 正则化的线性回归（L1正则 --> Lasso）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LassoCV on test is 0.514919400644\n",
      "The r2 score of LassoCV on train is 0.676002236532\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/wlq666888/APPs/Anaconda3-5.0.1-Linux-x86_64/Anaconda3-5.0.1/lib/python3.6/site-packages/sklearn/linear_model/coordinate_descent.py:1094: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n"
     ]
    }
   ],
   "source": [
    "#### Lasso／L1正则\n",
    "# class sklearn.linear_model.LassoCV(eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, \n",
    "#                                    normalize=False, precompute=’auto’, max_iter=1000, \n",
    "#                                    tol=0.0001, copy_X=True, cv=None, verbose=False, n_jobs=1,\n",
    "#                                    positive=False, random_state=None, selection=’cyclic’)\n",
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "#设置超参数搜索范围\n",
    "#alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "\n",
    "#生成一个LassoCV实例\n",
    "#lasso = LassoCV(alphas=alphas)  \n",
    "lasso = LassoCV()  \n",
    "\n",
    "#训练（内含CV）\n",
    "lasso.fit(X_train, y_train)  \n",
    "\n",
    "#测试\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "\n",
    "# 评估，使用r2_score评价模型在测试集和训练集上的性能\n",
    "print ('The r2 score of LassoCV on test is', r2_score(y_test, y_test_pred_lasso))\n",
    "print ('The r2 score of LassoCV on train is', r2_score(y_train, y_train_pred_lasso))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     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zzlWZWRbBvYhZodBIIfif9axQ30Q466pyzqV1UV1L\ngYtd8DrjIp7SHoNIS38zsz5AIvAj59x+AOfcETNbSPD6ubsiWVDocNcdCgWJFO0xiIhIC+p8FhGR\nFhQMIiLSgoJBRERaUDCIiEgLCgYREWlBwSAiIi38P5ILVLzfnCE4AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f77d12a14e0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 0.167027316518\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef_lasso</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0.020054</td>\n",
       "      <td>[0.696872603492]</td>\n",
       "      <td>[0.509706171955]</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>[0.593066294028]</td>\n",
       "      <td>[0.322924138591]</td>\n",
       "      <td>mnth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.175412</td>\n",
       "      <td>[0.292949119385]</td>\n",
       "      <td>[0.29485530753]</td>\n",
       "      <td>season</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>[0.0351745498474]</td>\n",
       "      <td>[0.0355210529109]</td>\n",
       "      <td>weekday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>[0.00757134060956]</td>\n",
       "      <td>[0.00760200478082]</td>\n",
       "      <td>workingday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.000000</td>\n",
       "      <td>[-0.0353950397988]</td>\n",
       "      <td>[-0.0342330597427]</td>\n",
       "      <td>holiday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>-0.000000</td>\n",
       "      <td>[-0.0534050464647]</td>\n",
       "      <td>[-0.0579147033201]</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0.510795</td>\n",
       "      <td>[-0.0628202221594]</td>\n",
       "      <td>[0.124916787824]</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>-0.000000</td>\n",
       "      <td>[-0.122264985044]</td>\n",
       "      <td>[-0.119995506635]</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-0.106182</td>\n",
       "      <td>[-0.231182077272]</td>\n",
       "      <td>[-0.226389415899]</td>\n",
       "      <td>weathersit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>[-0.589867988226]</td>\n",
       "      <td>[-0.322358198929]</td>\n",
       "      <td>instant</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    coef_lasso             coef_lr          coef_ridge     columns\n",
       "7     0.020054    [0.696872603492]    [0.509706171955]        temp\n",
       "2     0.000000    [0.593066294028]    [0.322924138591]        mnth\n",
       "1     0.175412    [0.292949119385]     [0.29485530753]      season\n",
       "4     0.000000   [0.0351745498474]   [0.0355210529109]     weekday\n",
       "5     0.000000  [0.00757134060956]  [0.00760200478082]  workingday\n",
       "3    -0.000000  [-0.0353950397988]  [-0.0342330597427]     holiday\n",
       "9    -0.000000  [-0.0534050464647]  [-0.0579147033201]         hum\n",
       "8     0.510795  [-0.0628202221594]    [0.124916787824]       atemp\n",
       "10   -0.000000   [-0.122264985044]   [-0.119995506635]   windspeed\n",
       "6    -0.106182   [-0.231182077272]   [-0.226389415899]  weathersit\n",
       "0     0.000000   [-0.589867988226]   [-0.322358198929]     instant"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mses = np.mean(lasso.mse_path_, axis = 1)\n",
    "plt.plot(np.log10(lasso.alphas_), mses) \n",
    "#plt.plot(np.log10(lasso.alphas_)*np.ones(3), [0.3, 0.4, 1.0])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()    \n",
    "            \n",
    "print ('alpha is:', lasso.alpha_)\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T)), \"coef_lasso\":list((lasso.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEKCAYAAAAW8vJGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xl8VOW9x/HPb7KThEAW9i0EkE1R\niOxY0N5q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g\nsdDf0rvAyPbWqTOfRUSkBR1KEhGRFhQMIiLSgoJBRERaUDCIiEgLCgYREWlBwSAxw8yqTvL3Hw+d\n+dpWm9famm003DYfaZ9jZn8Pt73IyVIwiITBzCYAcc65bZF+bedcCbDPzGZF+rUlNikYJOZY0O1m\ntj503YPPhZ4PmNndoesM/M3MnjOzy0K/dhXNzoo1s9+FJlV738x+2MrrVJnZr8xstZn9w8xymi2+\n3MzeNbPNZjYn1H6Emb0Rar/azGY2a/90qAYRzykYJBZdCpwOTAI+CdwemifnUmAEcCpwAzCj2e/M\nAlY1e3yrcy4fOA34hJmddoLXSQVWO+cmA6/Tct6teOfcVOCbzZ4vBv4p1P5zwG+atV8JzOn4pop0\nXMxNoicCzAYWO+cagQNm9jpwZuj5x5xzTcB+M3u12e8MBEqaPb4iNCV2fGjZeIJTqTTXBDwauv8Q\n8GSzZcfuryIYRgAJwF1mdjrQCIxp1r6Y4HQTIp5TMEgsau0iJW1dvOQIwTlnMLNc4N+BM51zB81s\n0bFl7Wg+/0xd6GcjH/4dfovgvEOTCO7N1zZrnxyqQcRzOpQksWgp8Dkziwsd9z+L4ORibwKfDfU1\n9Kfl9OobgFGh+72BaqAi1O7TrbxOgOBslgBfCK2/LRnAvtAey9UEL9t4zBi67yyr0s1oj0Fi0VME\n+w8KCH6L/7Zzbr+ZPQGcQ/A/4M3AcoJXu4LgtTnmAi875wrM7D2Cs59uA95q5XWqgQlmtiq0ns+1\nU9fdwBNmdjnwauj3j5kXqkHEc5pdVaQZM0tzzlWZWRbBvYhZodBIIfif9axQ30Q466pyzqV1UV1L\ngYtd8DrjIp7SHoNIS38zsz5AIvAj59x+AOfcETNbSPD6ubsiWVDocNcdCgWJFO0xiIhIC+p8FhGR\nFhQMIiLSgoJBRERaUDCIiEgLCgYREWlBwSAiIi38P5ILVLzfnCE4AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f77db6c0080>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 0.167027316518\n"
     ]
    }
   ],
   "source": [
    "mses = np.mean(lasso.mse_path_, axis = 1)\n",
    "plt.plot(np.log10(lasso.alphas_), mses) \n",
    "#plt.plot(np.log10(lasso.alphas_)*np.ones(3), [0.3, 0.4, 1.0])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()    \n",
    "            \n",
    "print ('alpha is:', lasso.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
